import { request } from '@/utils/request';

// 基础接口类型定义
export interface BaseResponse<T = any> {
  code: number;
  message: string;
  data: T;
}

export interface PageParams {
  page: number;
  pageSize: number;
  [key: string]: any;
}

export interface PageResult<T> {
  list: T[];
  total: number;
  page: number;
  pageSize: number;
}

// 酒店管理统一API
export const hotelApi = {
  // 获取系统统计数据
  getStatistics: () => request.get<BaseResponse>('/hotel/statistics'),

  // 获取房间列表
  getRooms: (params?: PageParams) =>
    request.get<BaseResponse<PageResult<any>>>('/hotel/rooms', { params }),

  // 获取租客列表
  getTenants: (params?: PageParams) =>
    request.get<BaseResponse<PageResult<any>>>('/hotel/tenants', { params }),

  // 获取费用列表
  getFees: (params?: PageParams) =>
    request.get<BaseResponse<PageResult<any>>>('/hotel/fees', { params }),

  // 获取工单列表
  getWorkOrders: (params?: PageParams) =>
    request.get<BaseResponse<PageResult<any>>>('/hotel/work-orders', {
      params,
    }),

  // 获取公告列表
  getAnnouncements: (params?: PageParams) =>
    request.get<BaseResponse<PageResult<any>>>('/hotel/announcements', {
      params,
    }),
};
